/*
 * Copyright (c) 2012 Android Dev Freelancer Team. All Rights Reserved.
 */
package com.devgroupvn.dota;

import android.app.Activity;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

/* 
 * @class Common
 * @author tkminh
 * @version 1.0, 23 May 2012
 * 
 */

public class Common {
	
	/**
	 * Init
	 */
	public Common() {
		
	}
	
	/**
	 * check the internet connection
	 * @param act
	 * @return boolean
	 */
	public boolean checkInternetConnection(Activity act) {
		ConnectivityManager cm = (ConnectivityManager) act.getSystemService(Context.CONNECTIVITY_SERVICE);
		NetworkInfo info = cm.getActiveNetworkInfo();
		if (info != null) {
			if (!info.isConnected()) {
				return false;
			} else {
				return true;
			}
		}
		return false;
	}
}
